<?php 
      echo $this->Html->css("chosen");
      echo $this->Html->css("dataTables");
      echo $this->Html->css("validationEngine.jquery");
 ?>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/dataTables.min.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/customInput.jquery.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/chosen.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/zice.custom1.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/accounting.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/ColVis.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/layout_table.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/manager_product.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/jquery.validationEngine.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/jquery.validationEngine-vi.js"></script>
<script type="text/javascript" src="<?php echo $this->webroot; ?>js/jquery.autotab.js"></script>

<div class="titlePage">
<h1>Quản lý sản phẩm - Sản phẩm</h1>
</div>
<div class="onecolumn">
	<div class="header">
		<span><span class="ico gray shopping_basket"></span>Sản phẩm</span>
	</div>
	<div class=" clear"></div>
	<div class="content">
		<div id="uploadTab">
                      <ul class="tabs" >
                          <li ><a href="#tab1"   >   Sản phẩm lẻ  </a></li>  
                          <li ><a href="#tab2"   >   Sản phẩm sĩ  </a></li>            
                      </ul>
                      <div class="tab_container" >
                      <div id="tab1" class="tab_content"> 
                            <div class="load_page">
				             	<form id="validation">
											<div class="tableName toolbar">
												<table class="display data_table2 listProductRetail" >
													<thead>
														<tr>
															<th><div class="th_wrapp">Tên hàng</div></th>
															<th><div class="th_wrapp">Quy cách</div></th>
															<th><div class="th_wrapp">Giá bán lẻ</div></th>
															<th><div class="th_wrapp">Số lượng lẻ</div></th>
															<th><div class="th_wrapp">Mã vạch</div></th>
															<th><div class="th_wrapp">Quản lý</div></th>
														</tr>
													</thead>
													<tbody>
													<?php 
								foreach ($productRetail as $item) {
							?>
									<tr class="odd gradeX editP" id="<?php echo $item['p']['id'].'_edit'?>">
				      					<td class='editName'><div class='old_name'><?php  echo $item['p']['name'];?></div>
				      						<input id="<?php echo $item['p']['id'].'_edit_n'?>" value ="<?php echo $item['p']['name'];?>" class='validate[required] tmp_name' style="display: none"/>
				      					</td>
				      					<td><?php  echo $item['u']['child'];?></td>
				      					<td class='editPriceRetail'><div class='old_price_retail formatMoney'><?php echo $item['p']['price_retail'];?></div>
				      						<input id="<?php echo $item['p']['id'].'_edit_pR'?>" value ="<?php echo $item['p']['price_retail'];?>" class='validate[required,min[1]] tmp_price_retail' style="display: none"/>
				      					</td>
				      					<td><?php  echo $item['p']['quantity_retail'];?></td>
				      					<td class='editBarcode'><div class='old_barcode'><?php echo $item['p']['barcode'];?></div>
				      						<input id="<?php echo $item['p']['id'].'_edit_bc'?>" value ="<?php echo $item['p']['barcode'];?>" class='validate[required] tmp_barcode' style="display: none"/>
				      					</td>
					      					<td >
				                                <span class='btnEditR'>
				                                      <a  title="Edit" >
				                                           <img src="<?php echo $this->webroot; ?>img/icon/color_18/pencil.png" >
				                                      </a>
				                                 </span> 
				                                 <span class="tip btnDelete" id="<?php echo $item['p']['id'].'_delete'?>" >
				                                       <a title="Delete"  >
				                                           <img src="<?php echo $this->webroot; ?>img/icon/color_18/delete.png" >
				                                       </a>
				                                </span> 
				                                <span class='btnSaveR' style="display: none">
				                                      <a  title="Save" >
				                                           <img src="<?php echo $this->webroot; ?>img/icon/color_18/checkmark2.png" >
				                                      </a>
				                                 </span>
				                                 <span class='btnCancelR' style="display: none">
				                                      <a  title="Cancel" >
				                                           <img src="<?php echo $this->webroot; ?>img/icon/color_18/cross.png" >
									                                      </a>
									                                 </span>
									                            </td>
				      										</tr><?php }?>
									</tbody>
								</table>
				            </div>
						</form>
						<div id="alert_product"></div>
						<form id="validation">
							<a class="uibutton icon add addNewProductRetail">Thêm mới</a>
							<div class="newProductRetail">
								<h4>Sản phẩm mới</h4>
								<div class="section">
									<label>
									Tên sản phẩm:
									
									</label>
									<div>
										<input class="validate[required] large" type="text" id="product_name">
										
									</div>
								</div>
								<div class="section numericonly">
									<label>
									Giá lẻ:
									
									</label>
									<div>
										<input class="validate[required,custom[onlyNumberSp]] large" type="text" id="product_price_retail">
										
									</div>
								</div>
								<div class="section">
									<label>
									Loại sản phẩm:
									
									</label>
									<div>
										<select id='product_type' class="chzn-select choose_type" tabindex="2" >
                          				<option value=""></option> 
										<?php foreach ($types as $item) {?>
											<option value="<?php echo $item['product_types']['id'] ?>"><?php echo $item['product_types']['name'];}?></option>
										</select>
										
									</div>
								</div>
								<div class="section">
									<label>
									Mã vạch:				
									</label>
									<div>
										<input class="validate[custom[onlyNumberSp]] large" type="text" id="product_retail_barcode">
									</div>
								</div>
								<div class="section">
									<label>
									Đơn vị tính:
									</label>
									<div>
										<select id='product_unit_retail' class="chzn-select choose_unit" tabindex="2" >
                          				<option value=""></option> 
											<?php foreach ($unitsCh as $item) {?>
											<option value="<?php echo $item['units']['id'] ?>"><?php echo $item['units']['child'];}?></option>
										</select>
									</div>
								</div>
								<div class="buttonNewProduct">
									<a class="uibutton add_product_retail"><span class="ico gray checkmark2"></span>Lưu</a>
									<a class="uibutton special cancel"><span class="ico gray cross"></span>Hủy</a>
								</div>
							</div>
						</form>
					</div>
       			 </div>
       			 
       			 <div id="tab2" class="tab_content"> 
                            <div class="load_page">
				             	<form id="validation">
											<div class="tableName toolbar">
												<table class="display data_table2 listProductWholesale" >
													<thead>
														<tr>
															<th><div class="th_wrapp">Tên hàng</div></th>
															<th><div class="th_wrapp">Quy cách</div></th>
															<th><div class="th_wrapp">Giá bán sỉ</div></th>
															<th><div class="th_wrapp">Số lượng sỉ</div></th>
															<th><div class="th_wrapp">Mã vạch</div></th>
															<th><div class="th_wrapp">Quản lý</div></th>
														</tr>
													</thead>
													<tbody>
													<?php 
								foreach ($productWholesale as $item) {
							?>
									<tr class="odd gradeX editP" id="<?php echo $item['p']['id'].'_edit'?>">
				      					<td class='editName'><div class='old_name'><?php echo $item['p']['name'];?></div>
				      						<input id="<?php echo $item['p']['id'].'_edit_n'?>" value ="<?php echo $item['p']['name'];?>" class='validate[required] tmp_name' style="display: none"/>
				      					</td>
				      					<td><?php echo $item['u']['father'].'/'.$item['u']['convert'].' '.$item['u1']['child'];?></td>
				      					<td class='editPriceWholesale'><div class='old_price_wholesale formatMoney'><?php echo $item['p']['price_wholesale'];?></div>
				      						<input id="<?php echo $item['p']['id'].'_edit_pW'?>" value ="<?php echo $item['p']['price_wholesale'];?>" class='validate[required,min[1]] tmp_price_wholesale' style="display: none"/>
				      					</td>
				      					<td><?php  echo $item['p']['quantity_wholesale'];?></td>
				      					<td class='editBarcode'><div class='old_barcode'><?php echo $item['p']['barcode'];?></div>
				      						<input id="<?php echo $item['p']['id'].'_edit_bc'?>" value ="<?php echo $item['p']['barcode'];?>" class='validate[required] tmp_barcode' style="display: none"/>
				      					</td>
					      					<td >
				                                <span class='btnEditW'>
				                                      <a  title="Edit" >
				                                           <img src="<?php echo $this->webroot; ?>img/icon/color_18/pencil.png" >
				                                      </a>
				                                 </span> 
				                                 <span class="tip btnDelete" id="<?php echo $item['p']['id'].'_delete'?>" >
				                                       <a title="Delete"  >
				                                           <img src="<?php echo $this->webroot; ?>img/icon/color_18/delete.png" >
				                                       </a>
				                                </span> 
				                                <span class='btnSaveW' style="display: none">
				                                      <a  title="Save" >
				                                           <img src="<?php echo $this->webroot; ?>img/icon/color_18/checkmark2.png" >
				                                      </a>
				                                 </span>
				                                 <span class='btnCancelW' style="display: none">
				                                      <a  title="Cancel" >
				                                           <img src="<?php echo $this->webroot; ?>img/icon/color_18/cross.png" >
									                                      </a>
									                                 </span>
									                            </td>
				      										</tr><?php }?>
									</tbody>
								</table>
				            </div>
						</form>
						<div id="alert_product"></div>
						<form id="validation">
							<a class="uibutton icon add addNewProductWholesale">Thêm mới</a>
							<div class="newProductWholesale">
								<h4>Sản phẩm mới</h4>
								<div class="section">
									<label>
									Tên sản phẩm:
									
									</label>
									<div>
									
										<select id='product_retail'class="chzn-select choose_product_name" tabindex="2" >
                          						<option value=""></option> 
												<?php foreach ($productRetail as $item) {?>
												<option value="<?php echo $item['p']['id'] ?>"><?php echo $item['p']['name'];}?></option>
										</select>
									</div>
								</div>
								<div class="section numericonly">
									<label>
									Giá sỉ:
									
									</label>
									<div>
										<input class="validate[required,custom[onlyNumberSp]] large" type="text" id="product_price_wholesale">
										
									</div>
								</div>								
								<div class="section">
									<label>
									Mã vạch:				
									</label>
									<div>
										<input class="validate[custom[onlyNumberSp]] large" type="text" id="product_wholesale_barcode">
									</div>
								</div>
								<div class="section">
									<label>
									Đơn vị tính:
									</label>
									<div>
										<select id='product_unit_wholesale'class="chzn-select choose_unit_wholesale" tabindex="2" >
                          					<option value=""></option> 
											<?php foreach ($unitsF as $item) {?>
											<option value="<?php echo $item['units']['id'] ?>"><?php echo $item['units']['father'].' / '. $item['units']['convert'];}?></option>
										</select>
									</div>
								</div>
								<div class="buttonNewProduct">
									<a class="uibutton add_product_wholesale"><span class="ico gray checkmark2"></span>Lưu</a>
									<a class="uibutton special cancel"><span class="ico gray cross"></span>Hủy</a>
								</div>
							</div>
						</form>
					</div>
       			 </div>
			</div>
		</div>
		<div class="clear"/></div>  
	</div>
</div>